﻿/*
 * Copyright © 2020, Wuxi Safover Intelligent Technology Co., Ltd. All rights reserved.
 * 
 * 无锡安永智能科技有限公司版权所有，未经许可，不得用于商业用途
 * 
 * Visit: https://www.safover.com/ 
 */

using Safover.Lidar.DataContract;
using System;

namespace Safover.LidarCollector.Models
{
    public class WorkModeConfig : BaseDataModel
    {
        public LidarWorkMode SeletedLidarWorkMode
        {
            get => SelectedConfig.LidarWorkMode;
            set
            {
                switch (value)
                {
                    case LidarWorkMode.Fixed:
                        SelectedConfig = FixedDirectionScanConfig;
                        break;
                    case LidarWorkMode.Horizontal:
                        SelectedConfig = HorizontalScanConfig;
                        break;
                    case LidarWorkMode.Vertical:
                        SelectedConfig = VerticalScanConfig;
                        break;
                    case LidarWorkMode.Underway:
                        SelectedConfig = UnderwayScanConfig;
                        break;
                    case LidarWorkMode.Multi:
                        SelectedConfig = MultiScanConfig;
                        break;
                    default:
                        throw new InvalidOperationException($"Unsupport scan mode = [{value}]");
                }
            }
        }


        private BaseLidarScanConfig selectedConfig;
        public BaseLidarScanConfig SelectedConfig
        {
            get { return (BaseLidarScanConfig)selectedConfig.Clone(); }
            private set { selectedConfig = value; }
        }

        public FixedDirectionScanConfig FixedDirectionScanConfig { get; set; }

        public UnderwayScanConfig UnderwayScanConfig { get; set; }

        public HorizontalScanConfig HorizontalScanConfig { get; set; }

        public VerticalScanConfig VerticalScanConfig { get; set; }

        public MultiScanConfig MultiScanConfig { get; set; }

        public override string ToString()
        {
            return $"{SeletedLidarWorkMode}";
        }

    }

}
